import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

/// 虚幻标签切换器 - Log In / Sign Up 切换
class EtherealTabSwitcher extends StatelessWidget {
  final bool isLoginMode;
  final VoidCallback onToggle;

  const EtherealTabSwitcher({
    super.key,
    required this.isLoginMode,
    required this.onToggle,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.symmetric(horizontal: 40.w),
      decoration: BoxDecoration(
        color: Colors.white.withValues(alpha: 0.9),
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(25.r),
          topRight: Radius.circular(25.r),
        ),
        boxShadow: [
          BoxShadow(
            color: Colors.black.withValues(alpha: 0.1),
            blurRadius: 10,
            offset: const Offset(0, -2),
          ),
        ],
      ),
      child: Row(
        children: [
          Expanded(
            child: GestureDetector(
              onTap: isLoginMode ? null : onToggle,
              child: Container(
                padding: EdgeInsets.symmetric(vertical: 16.h),
                decoration: BoxDecoration(
                  color: isLoginMode ? Colors.transparent : Colors.white,
                  borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(25.r),
                  ),
                  border: isLoginMode ? null : Border(
                    bottom: BorderSide(
                      color: const Color(0xFFD2691E),
                      width: 3.w,
                    ),
                  ),
                ),
                child: Text(
                  'Log In',
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    fontSize: 18.sp,
                    fontWeight: isLoginMode ? FontWeight.w500 : FontWeight.bold,
                    color: isLoginMode ? Colors.grey[600] : Colors.black87,
                  ),
                ),
              ),
            ),
          ),
          Expanded(
            child: GestureDetector(
              onTap: isLoginMode ? onToggle : null,
              child: Container(
                padding: EdgeInsets.symmetric(vertical: 16.h),
                decoration: BoxDecoration(
                  color: !isLoginMode ? Colors.transparent : Colors.white,
                  borderRadius: BorderRadius.only(
                    topRight: Radius.circular(25.r),
                  ),
                  border: !isLoginMode ? null : Border(
                    bottom: BorderSide(
                      color: const Color(0xFFD2691E),
                      width: 3.w,
                    ),
                  ),
                ),
                child: Text(
                  'Sign Up',
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    fontSize: 18.sp,
                    fontWeight: !isLoginMode ? FontWeight.w500 : FontWeight.bold,
                    color: !isLoginMode ? Colors.grey[600] : Colors.black87,
                  ),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
